<?php

namespace app\mobile\controller;

use app\mobile\model\NewsModel;
use app\mobile\model\TypeModel;

class Mynew extends Base {

    public function index() {
        $typeId = input('id', 0);
        /*         * 获取子栏目* */
        $typeModel = new TypeModel();
        $newsTypeList = $typeModel->getList('news', 5);
        $typename = $typeModel->getTypename($typeId);
        /*         * 获取指定id栏目文章* */
        $newsModel = new NewsModel();

        $newsList = $newsModel->getList($typeId, 5);

        return $this->fetch('index', [
                    'typename' => $typename['typeName'],
                    'typeList' => $newsTypeList,
                    'newsList' => $newsList,
                    'typeId' => $typeId,
        ]);
    }

    public function body() {

        $id = input('id');


        $newsModel = new NewsModel();
        $info = $newsModel->getInfo($id);
        return $this->fetch('body', [
                    'info' => $info,
        ]);
    }

}
